<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ProjectYsRequest extends BaseFormRequest
{


    public function rules()
    {
       return [
           'xmid'=>'required|exists:project_lx,id',
           'desc'=>'sometimes|nullable|string',
           'tax'=>'present|nullable|string',
           'profit'=>'sometimes|nullable|string',
           'total'=>'present|nullable|string',
           'percent'=>'present|nullable|string',
           'fileList'=>'present|nullable|array',
           'is_save'=>'present|in:0,1',
           'ysid'=>'present|numeric',
           'ysData'=>'required|array',
           'ysData.*.title'=>"required|string",
           'ysData.*.money'=>"required|string",
           'ysData.*.desc'=>"sometimes|nullable|string",
           'ysData.*.paytype'=>"required|numeric",
       ];
    }

    public function messages()
    {
        return [
            'xmid.required'=>'项目ID不能为空',
            'profit.string'=>'利润不能为空',
            'ysData.required'=>'预算列表不能为空',
            'ysData.*.title.required'=>'预算名称不能为空',
            'ysData.*.money.required'=>'预算金额不能为空',
            //'ysData.*.desc.required'=>'预算备注不能为空',
            'ysData.*.paytype.required'=>'预算类型不能为空',
        ];
    }
}
